<?php
Yii::import('Gallery.components.GalleryHelper');
?>
<h3 class="title"><?php echo $this->title; ?></h3>
<ul id="mycarousel" class="jcarousel-skin-tango">
        <?php
            $photos=GalleryHelper::getListPhoto($this->galleryId,false);
            if(count($photos)){
                foreach($photos as $photo){
                    if ($photo->name=='' && $photo->description=='')
                        $str = '<li>';
                    else
                        $str = '<li class="photo-with-info"><p class="hidden-photo-info" style="display: none;"><b>'.$photo->name.'</b><br />'.nl2br($photo->description).'</p>';
                    $img = CHtml::image($photo->path,'',array('width'=>$this->width,'height'=>$this->height));
                    if (!empty($photo->website))
                        $str .= '<a target="_blank" href="'.$photo->website.'">'.$img.'</a>';
                    else
                        $str .= $img;
                    $str .= '</li>';
                    echo $str;
                }
            }
        ?>
</ul>

<script type="text/javascript">
$(document).ready(function(){
    $('#mycarousel li.photo-with-info').tooltip({
       bodyHandler: function() {
            return $(this).find('p.hidden-photo-info').html();
       },
       showURL: false
    });
});
</script>